<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 

<h:head></h:head> 
<h:body> 
	<h:form>
		<h:panelGrid columns="2">
			<h:outputLabel value="Marca: " for="marca"/>
			<h:inputText value="#{carroManagedBean.carro.marca}" id="marca"/>
			
			<h:outputLabel value="Modelo: " for="modelo"/>
			<h:inputText value="#{carroManagedBean.carro.modelo}" id="modelo"/>
			
			<h:commandButton value="Adicionar Carro" action="#{carroManagedBean.adicionarCarro()}" />
		</h:panelGrid>
	</h:form>
	
	<h:panelGroup rendered="#{not empty carroManagedBean.carros}">
		<h1>Lista de carros</h1>
		<ul>
			<ui:repeat var="carro" value="#{carroManagedBean.carros}">
				<li>
					<h:outputText value="#{carro.marca}" />
				</li>
			</ui:repeat>
		</ul>
	</h:panelGroup>
</h:body> 
</html>
